import React, { Component } from 'react';
import axios from 'axios'
import {Link} from 'react-router-dom'
import './index.css'
class Index extends Component {
    constructor(props){
        super(props)
        this.state={
            comming:[]
        }
    }
    componentDidMount(){
        axios.get("http://122.112.161.135:4000/api/movie/comingSoon").then(res=>{
            console.log(res.data.res);
            this.setState({
                comming:res.data.res

            })
        })
    }
    render() {
        const ListItem =this.state.comming.map(item=>{
            return (<div key={item.id} >
                <Link to={`/detail?id=${item._id}`}>
                <div className="navv">
                <img src={item.pic} alt="" />
                <p>{item.title}</p>
                </div>
                </Link>
            </div>)
        })
        return (
            <div>
               {ListItem}
            </div>
        );
    }
}

export default Index;
